<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("miniflyer", $con);
$dateTime = date("Y-m-d",strtotime("-1 day"));
#$dateTime = '2012-03-28';
$logdate =  mysql_query("SELECT DISTINCT dataTime FROM `miniflyer_query`");
while($everylogdate = mysql_fetch_array($logdate))
{
  mysql_query("INSERT INTO miniflyer_query_temp
SELECT max(id),
  SceneAvatar,
  SceneBank,
  SceneCredits,
  SceneExcess,
  SceneGameOver,
  SceneItems,
  SceneMainGame,
  SceneMainMenu,
  SceneOption,
  SceneProfile,
  SceneStash,
  SceneUpgrades,
  dayGetMoney,
  dayPlayAvgTime,
  dayPlayLongTime,
  dayPlayNowTime,
  dayPlayShortTime,
  dayPlayTime,
  dayTotalTime,
  dayUsedMoney,
  firstlogindata,
  firstlogin,
  jailbreak,
  lastUi,
  nowMoney,
  totalMoney,
  totalTime,
  dayEffortA,
  dayEffortB,
  dayEffortC,
  buyAvatarC1,
  buyAvatarC2,
  buyAvatarC3,
  buyAvatarC4,
  buyAvatarC5,
  buyAvatarC6,
  equipUpInfosB1,
  equipUpInfosB2,
  equipUpInfosB3,
  equipUpInfosB4,
  equipUpInfosB5,
  equipUpInfosB6,
  equipUpInfosB7,
  equipUsedInfosA1,
  equipUsedInfosA2,
  equipUsedInfosA3,
  equipUsedInfosA4,
  equipUsedInfosA5,
  _099Time,
  _1999Time,
  _199Time,
  _299Time,
  _499Time,
  _999Time,
  Total,
  _099Total,
  _1999Total,
  _199Total,
  _299Total,
  _499Total,
  _999Total,
  deviceid,
  gamename,
  createdate,
  date,
  dataTime,
  coinDoubleIAP
FROM miniflyer_query
WHERE dataTime = '$everylogdate[dataTime]'
GROUP BY deviceid");
}
#mysql_query("INSERT INTO dinocap2hd SELECT NULL,dayGetMoney, dayIap1BuyTimes,dayIap2BuyTimes,dayIap3BuyTimes,dayIap4BuyTimes,dayIap5BuyTimes,dayIap6BuyTimes,dayIapMoney,dayPlayTime,dayTotalTime,dayUI1TapCount,dayUI2TapCount,dayUI3TapCount,dayUI4TapCount,dayUI5TapCount,dayUI6TapCount,dayUI7TapCount,dayUI8TapCount,dayUI9TapCount,dayUsedMoney,firstlogindata,firstlogin,fromNotificationCount,isjailbreak,lastMission,lastMissionState,lastMissionType,lastTapUI,mission1End,mission1Exit,mission1Retry,mission1Select,mission2End,mission2Exit,mission2Retry,mission2Select,mission3End,mission3Exit,mission3Retry,mission3Select,mission4End,mission4Exit,mission4Retry,mission4Select,mission5End,mission5Exit,mission5Retry,mission5Select,mission6End,mission6Exit,mission6Retry,mission6Select,mission7End,mission7Exit,mission7Retry,mission7Select,mission8End,mission8Exit,mission8Retry,mission8Select,nowMoney,player1DayExp,player1Level,player1TotalExp,player1Weapon1Level,weapon1IsUpdate,player1Weapon2Level,weapon2IsUpdate,player1Weapon3Level,weapon3IsUpdate,player1Weapon4Level,weapon4IsUpdate,player1Weapon5Level,weapon5IsUpdate,player1Weapon6Level,weapon6IsUpdate,player1WeaponBulletCount,player1WeaponBulletMoney,player1WeaponUpdateCount,player1WeaponUpdateMoney,player2DayExp,player2Level,player2TotalExp,player2Weapon1Level,weapon1IsUpdate_2,player2Weapon2Level,weapon2IsUpdate_2,player2Weapon3Level,weapon3IsUpdate_2,player2Weapon4Level,weapon4IsUpdate_2,player2Weapon5Level,weapon5IsUpdate_2,player2Weapon6Level,weapon6IsUpdate_2,player2WeaponBulletCount,player2WeaponBulletMoney,player2WeaponUpdateCount, player2WeaponUpdateMoney , player3DayExp, player3Level, player3TotalExp, player3Weapon1Level,weapon1IsUpdate_3,player3Weapon2Level,weapon2IsUpdate_3,player3Weapon3Level,weapon3IsUpdate_3,player3Weapon4Level,weapon4IsUpdate_3,player3Weapon5Level,weapon5IsUpdate_3,player3Weapon6Level,weapon6IsUpdate_3,player3WeaponBulletCount,player3WeaponBulletMoney,player3WeaponUpdateCount,player3WeaponUpdateMoney,player4DayExp,player4Level,player4TotalExp,player4Weapon1Level,weapon1IsUpdate_4,player4Weapon2Level,weapon2IsUpdate_4,player4Weapon3Level,weapon3IsUpdate_4,player4Weapon4Level,weapon4IsUpdate_4,player4Weapon5Level,weapon5IsUpdate_4,player4Weapon6Level,weapon6IsUpdate_4,player4WeaponBulletCount,player4WeaponBulletMoney,player4WeaponUpdateCount,player4WeaponUpdateMoney,player5DayExp,player5Level,player5TotalExp,player5Weapon1Level,weapon1IsUpdate_5,player5Weapon2Level,weapon2IsUpdate_5,player5Weapon3Level,weapon3IsUpdate_5,player5Weapon4Level,weapon4IsUpdate_5,player5Weapon5Level,weapon5IsUpdate_5,player5Weapon6Level,weapon6IsUpdate_5,player5WeaponBulletCount,player5WeaponBulletMoney,player5WeaponUpdateCount,player5WeaponUpdateMoney,totalMoney,totalTime,deviceid,gamename,whatday,createdate,date  FROM  dinocap2hd_query_temp");
#mysql_query("rename table dinocap2hd_query_temp to dinocap2hd");
mysql_close($con);
?>